<template>
  <transition name="fade">
    <router-view></router-view>
  </transition>
</template>

<script>
export default {

  //解决刷新页面后，store数据消失
  created () {
    var self = this;
    // 在页面加载时读取sessionStorage里的状态信息
    if (sessionStorage.getItem('store')) {
      // 存储状态
      this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('store'))))
    }
    // 在页面刷新时将vuex里的信息保存到sessionStorage里
    window.addEventListener("click", function () {
      sessionStorage.setItem('store', JSON.stringify(self.$store.state))
    });
  }
}
</script>


<style >
.el-card__body {
  padding: 10px;
}

/* .el-tree-node.is-current .el-tree-node__content {
  color: #43a047;
  background-color: #ecf8ee;
} */

.api-title {
  clear: both;
  font-weight: 400;
  border-left: 3px solid #39b3a3;
  padding-left: 8px;
  display: inline-block;
  margin: 0;
  padding-top: 6px;
  padding-bottom: 6px;
}

pre {
  display: block;
  padding: 9.5px;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.42857143;
  color: #333;
  word-break: break-all;
  word-wrap: break-word;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: auto;
}

.string {
  color: green;
}

.number {
  color: darkorange;
}

.boolean {
  color: blue;
}

.null {
  color: magenta;
}

.key {
  color: red;
}
</style>